﻿@{
    Layout = null;
    ChestPainCenterSystem.ThreeCenterManage.PatientInfo P = ViewData["Patient"] as ChestPainCenterSystem.ThreeCenterManage.PatientInfo;
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>质控点执行</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/ligerui-icons.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Gray/css/all.css" />
    <link rel="stylesheet" href="~/Content/css/common.css" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/ligerUI/js/ligerui.all.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMdd")"></script>
</head>
<body>
    <div class="searchbar">
    </div>
    <div class="topPosition">
        <input type="hidden" id="pidd" value="@ViewBag.patientId" />
        <div style="float:left;font-size:13px;">
            <div style="float:left; margin-left:20px;">
                患者：
                <select style="width:150px;" id="selPatientList" ></select>
            </div>
            <div style="float:left; margin-left:20px;">
                初步诊断：<label id="Disease">@(P == null ? "" : P.PRE_DIAGNOSIS)</label>
            </div>
        </div>
        <div style="float:right;margin-right:10px;"></div>
    </div>
    <div id="maingrid"></div>
    <script type="text/javascript">
        $(document).ready(function () {
            GetPatients();
            $("#selPatientList").change(function () {
                initTable();
                GetCaseHistory();
            })
        })

        function GetPatients() {
            $.ajax({
                url: "/ChestPainCenter/FirstAid/GetPatientList",
                cache: false,
                success: function (data) {
                    var d = $.parseJSON(data);
                    if (d.Result == 1) {
                        var jsonData = $.parseJSON(d.Body);
                        $("#selPatientList").html('');
                        for (var i = 0; i < jsonData.length; i++) {
                            var age = IsEmpty(jsonData[i].PATIENT_AGE) ? "" : jsonData[i].PATIENT_AGE + "岁";
                            $("#selPatientList").append("<option value=" + jsonData[i].PATIENT_ID + ">" + jsonData[i].PATIENT_NAME + "&nbsp;&nbsp;&nbsp;" + jsonData[i].PATIENT_SEX + "&nbsp;&nbsp;&nbsp;" + age + "</option>");
                        }
                        initTable();
                        GetCaseHistory();
                    }
                },
                error: function () {
                    $.ligerDialog.error("程序错误");
                }
            });
        }
        var manager;
        function initTable() {
            var selectVal = $("#selPatientList").val();
            if (typeof (selectVal) == "undefined" || selectVal == null || selectVal == "" || parseInt(selectVal) <= 0)
                return;
            manager = $("#maingrid").ligerGrid({
                url: '/ChestPainCenter/PathwayExe/Search?PatientID=' + selectVal + '&ram=' + Math.random(),
                columns: [
                    { display: '质控项', name: 'Title', align: 'left', width: 220 },
                    { display: '对比项', name: 'ComparePointTitle',align:'left',width:220 },
                    { display: '执行人', name: 'Name', align: 'left', width: 220 },
                    {
                        display: '执行时间', name: 'Time', align: 'left', width: 220,
                        render: function (rowData) {
                           return obj2Timemm(rowData.Time);
                        }
                    },
                    //{ display: '时限', name: 'Sort', minWidth: 20, editor: { type: "string" } },
                    {
                        display: '时限提醒', name: 'OverTimeBool', minWidth: 20, render: function (rowdata, rowindex, value) {
                            var html = "";
                            if (value == true) {
                                html += "<font style='color:red';>已超时</font>";
                            }
                            else {
                                if (rowdata.Tag != null && rowdata.Tag != '') {
                                    html += rowdata.Tag;
                                }
                            }
                            return html;
                        }
                    },
                    //{ display: '漏项提醒', name: 'Time', align: 'left', width: 220, editor: { type: "number" } }
                ],
                enabledEdit: true,
                usePager: false,
                rownumbers: true,
                height: '100%',
                heightDiff: 25
            });
        }
        function GetCaseHistory() {
            var selectVal = $("#selPatientList").val();
            if (typeof (selectVal) == "undefined" || selectVal == null || selectVal == "" || parseInt(selectVal) <= 0)
                return;
            $.ajax({
                url: "/ChestPainCenter/MedicalRecords/GetCaseHistory?Pid=" + selectVal,
                cache: false,
                success: function (data) {
                    var d = $.parseJSON(data);
                    if (d.Result == 1) {
                        var jsonData = $.parseJSON(d.Body);
                        if (jsonData.PreDiagnosis == null) {
                            $("#Disease").text("未诊断");
                        } else {
                            $("#Disease").text(jsonData.PreDiagnosis);
                            Ldis = jsonData.PreDiagnosis;
                        }
                    }
                }
            })
        }
    </script>
</body>
</html>